<?php 
/**
 * Parameters
 * @param OrganizationalUnit 	$organizational_unit 			Current Organizational Unit
 * @param Doctrine_Collection 	$members 						Collection of members assigned to the current organizational unit
 * @param Doctrine_Collection 	$related_organizational_units
 */
?>
<?php slot('heading', $organizational_unit->getName());?>
<?php slot('current_nav_tab', 'member');?>
<?php slot('stripe_search', get_partial('member/stripe_search_form'));?>

		<div class="x8">
				
			<?php include_partial('member/list', array('members' => $members, 'organizational_unit' => $organizational_unit, 'checkboxes' => false));?>
		
		</div>
		
		<div class="x4">
			<h2 class="box">Werkzeugbox<img alt="Werkzeugbox" src="<?php echo image_path('icons/content_werkzeugbox.png')?>" /></h2>
			<table class="box_table subnavigation">
				<tbody>
					<tr>
						<td><a href="<?php echo url_for('member_new', array('sf_subject' => null, 'unit' => $organizational_unit));?>"><img alt="Mitglied hinzuf&uuml;gen" src="<?php echo image_path('icons/content_subnavigation_plus.png')?>" />Mitglied hinzuf&uuml;gen</a></td>
					</tr>
					<?php if($sf_user->hasCredential('admin')):?>
					<tr>
						<td><a href="<?php echo url_for('organizational_unit_recently_deleted_members', $organizational_unit);?>"><img alt="Kürzlich gelöschte Mitglieder" src="<?php echo image_path('icons/content_loeschen.png')?>" />Kürzlich gelöschte Mitglieder</a></td>
					</tr>
					<?php endif;?>
					<?php if($organizational_unit->canHaveChildEntities()):?>
					<tr>
						<td><a href="<?php echo url_for('organizational_unit_new', $organizational_unit);?>"><img alt="Untergliederung hinzuf&uuml;gen" src="<?php echo image_path('icons/content_subnavigation_plus.png')?>" />Untergliederung hinzuf&uuml;gen</a></td>
					</tr>
					<?php endif;?>
					<tr>
						<td><a href="<?php echo url_for('organizational_unit_edit', $organizational_unit)?>"><img alt="<?php echo $organizational_unit->getEntity()->getName();?> bearbeiten" src="<?php echo image_path('icons/content_subnavigation_bearbeiten.png')?>" /><?php echo $organizational_unit->getEntity()->getName();?> bearbeiten</a></td>
					</tr>
<!--					<tr>-->
<!--						<td><a href="#"><img alt="als CSV exportieren" src="<?php echo image_path('icons/content_subnavigation_export.png')?>" />als CSV exportieren</a></td>-->
<!--					</tr>-->
					<?php if($sf_user->hasCredential('batch_payment')):?>
					<tr>
						<td><a href="<?php echo url_for('organizational_unit_mass_payment', $organizational_unit);?>"><img alt="Massen-Bezahlen starten" src="<?php echo image_path('icons/content_subnavigation_massenbezahlen.png')?>" />Massen-Bezahlen starten</a></td>
					</tr>
					<?php endif;?>
<!--					<tr>-->
<!--						<td><a href="#"><img alt="Stamm l&ouml;schen" src="<?php echo image_path('icons/content_loeschen.png')?>" />Stamm l&ouml;schen</a></td>-->
<!--					</tr>-->
				</tbody>
			</table>
		</div>
		
		<div class="x4">
			<h2 class="box">Untergliederung wechseln<img alt="Untergliederung wechseln" src="<?php echo image_path('icons/content_baum.png')?>" /></h2>
			<table class="box_table subnavigation baum">		
				<tbody>
					<?php $level_offset = $related_organizational_units->getFirst()->getLevel(); ?>
					<?php foreach($related_organizational_units as $unit):?>
					<tr>
						<td <?php if($unit->getId() == $organizational_unit->getId()):?>class="aktiv"<?php endif;?>><a href="<?php echo url_for('organizational_unit_portal', $unit)?>"><?php echo str_repeat('&nbsp;&nbsp;&nbsp;', ($unit->getLevel() - $level_offset)) ?><?php echo $unit->getName();?></a></td>
					</tr>
					<?php endforeach;?>
				</tbody>
			</table>
		</div>